package com.example.demo.tree;

import java.util.Random;

public class Main2 {

    public static void main(String[] args) {

        long start = System.currentTimeMillis() ;

        RBTree<String, String> map = new RBTree<>();
        int size = 1000000 ;

        String[] keys = new String[size] ;


        for(int i =0 ;i < size ; i++){
            int x = new Random().nextInt();
            String tmp = String.valueOf(x) ;
            keys[i] = tmp ;
            map.add(tmp,tmp) ;;
            System.out.println(map.checkInvariants());
        }

        for(int i =0 ;i < size ; i++){
            map.remove(keys[i]) ;
            System.out.println(map.checkInvariants());
        }


        System.out.println();

        long end = System.currentTimeMillis() ;

        System.out.println(end-start);
    }





}
